package com.uit.project.bustrip.adapter;

import java.util.ArrayList;

import com.uit.project.bustrip.R;
import com.uit.project.bustrip.entity.Seat;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ListSeatAdapter extends BaseAdapter{
	private Context context;
	private ArrayList<Seat> items;
	public ListSeatAdapter(Context context, ArrayList<Seat> items) {
		super();
		this.context = context;
		this.items = items;
	}
	@Override
	public int getCount() {
		return items.size();
	}

	@Override
	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int arg0) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		Seat item = items.get(position);
		View gridView;
		if (convertView == null) {
			gridView = new View(context);
			gridView = inflater.inflate(R.layout.activity_chose_seat_item, null);
			TextView textView = (TextView) gridView
					.findViewById(R.id.grid_item_number);
			textView.setText(String.valueOf(item.position));

			// set image based on selected text
//			ImageView imageView = (ImageView) gridView
//					.findViewById(R.id.grid_item_image);
		} else {
			gridView = (View) convertView;
		}
		return gridView;
	}

}
